package com.boxing.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/JSPServlet")
public class JSPServlet extends HttpServlet {
    int i = 0;
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //访问数据库
        i++;
        resp.getWriter().print("<!DOCTYPE html>\n" +
                "<html lang=\"en\">\n" +
                "<head>\n" +
                "    <meta charset=\"UTF-8\">\n" +
                "    <title>Title</title>\n" +
                "    <script src=\"https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js\"></script>\n" +
                "    <script src=\"https://cdn.bootcdn.net/ajax/libs/axios/1.3.6/axios.js\"></script>\n" +
                "</head>\n" +
                "<body>\n" +
                "<div>JSPServlet-" +i+
                "    <label>邮 箱</label><input class=\"user\" name=\"user\" placeholder=\"请输入邮箱名\"/><br/>\n" +
                "    <label>密 码</label><input class=\"psd\" name=\"psd\" type=\"password\" placeholder=\"请输入密码\"/><br/>\n" +
                "    <button onclick=\"getData()\">登录</button>\n" +
                "    <div class=\"hint\"></div>\n" +
                "</div>\n" +
                "</body>\n" +
                "</html>");
    }
}
